import turtle

def draw_dog():
    # 设置画布和初始参数
    screen = turtle.Screen()
    screen.title("简笔画小狗")
    screen.bgcolor("white")
    
    # 创建绘图对象
    dog = turtle.Turtle()
    dog.speed(3)  # 绘制速度：1(慢)到10(快)，0为最快
    dog.color("black")
    dog.pensize(2)
    
    # 绘制头部
    dog.circle(50)  # 头部是一个圆形
    
    # 绘制左耳
    dog.penup()
    dog.goto(-35, 90)
    dog.pendown()
    dog.setheading(160)
    dog.circle(30, 100)
    
    # 绘制右耳
    dog.penup()
    dog.goto(35, 90)
    dog.pendown()
    dog.setheading(20)
    dog.circle(-30, 100)
    
    # 绘制左眼
    dog.penup()
    dog.goto(-20, 60)
    dog.pendown()
    dog.begin_fill()
    dog.circle(5)
    dog.end_fill()
    
    # 绘制右眼
    dog.penup()
    dog.goto(20, 60)
    dog.pendown()
    dog.begin_fill()
    dog.circle(5)
    dog.end_fill()
    
    # 绘制鼻子
    dog.penup()
    dog.goto(0, 40)
    dog.pendown()
    dog.begin_fill()
    dog.circle(8)
    dog.end_fill()
    
    # 绘制嘴巴
    dog.penup()
    dog.goto(0, 40)
    dog.pendown()
    dog.setheading(270)
    dog.forward(15)
    dog.setheading(225)
    dog.forward(10)
    dog.penup()
    dog.goto(0, 25)
    dog.pendown()
    dog.setheading(315)
    dog.forward(10)
    
    # 绘制身体
    dog.penup()
    dog.goto(0, 0)
    dog.pendown()
    dog.setheading(270)
    dog.forward(80)
    dog.setheading(0)
    dog.forward(60)
    dog.setheading(90)
    dog.forward(40)
    
    # 绘制尾巴
    dog.setheading(45)
    dog.forward(40)
    dog.setheading(0)
    dog.forward(20)
    
    # 绘制左腿
    dog.penup()
    dog.goto(0, -40)
    dog.pendown()
    dog.setheading(270)
    dog.forward(30)
    dog.setheading(180)
    dog.forward(20)
    
    # 绘制右腿
    dog.penup()
    dog.goto(60, -40)
    dog.pendown()
    dog.setheading(270)
    dog.forward(30)
    dog.setheading(0)
    dog.forward(20)
    
    # 隐藏画笔
    dog.hideturtle()
    
    # 保持窗口打开
    screen.mainloop()

if __name__ == "__main__":
    draw_dog()
